<template>
	<view name='user'>
		<view class="flex-col group">
			<view class="flex-col section_1">
				<text class="text">个人中心</text>
				<view class="justify-between group_1">
					<view class="flex-row" style="width:70vw;">
						<image :src="info.avatar" class="image" />
						<!-- <image
              :src="avatar"
              class="image"
            /> -->
						<view class="flex-col group_3">
							<view class="flex-row">
								<!-- <text class="text_1">{{nikeName}}</text> -->
								<text class="text_1">{{info.nikeName}}</text>
							</view>
							<!-- <text class="text_2" v-if="!vip">当前身份：普通用户</text>
              <text class="text_2" v-else>当前身份：{{yesnovip}}</text> -->
							<text class="text_2">会员等级：{{info.vipName}}</text>
						</view>
					</view>
					<view class="flex-col items-center section_2" @click="qiandao">
						<view class="flex-row items-center text-wrapper">
							<view class="u-icon">
								<u-icon name="checkbox-mark" color="#FFFFFF" size="20"></u-icon>
							</view>

							<text class="text_3">签到</text>

							</view>
					</view>
					<!--  <view class="signIn">
              <image src="../../static/uservip.png" style=""></image>签到
          </view> -->
				</view>
				<view class="" style="display: flex;justify-content: flex-end;">

				</view>

				<view class="flex-col group_5">
					<view class="flex-col section_6">
						<view class="flex-row block_1">
							<view class="flex-row block_11">
								<image class="image-1" src="../../static/xingzuan.png"></image>
								<text class="text-23">会员用户</text>
							</view>
							<view class="flex-row block_12" @click="discountCoupon()">
								<text class="text-24">查看会员特权</text>
								<view class="image-2">
								<u-icon name="play-right-fill" color="#909399" size="14" ></u-icon>
								</view>
							</view>
						</view>
						<view class="flex-row block_2">
							<view class="block_21">
								<view class="block_211">{{info.balance}}</view>
								<view class="flex-row block_212">
									<text class="text-25">余额</text>
									<view class="button">
									<u-button type="primary" shape="circle" :plain="true" text="充值" size="mini" @click="recharge()"></u-button>
									</view>
								</view>
							</view>
							<view class="flex-col block_22">
								<text class="text-26">{{info.distributionIncome}}</text>
								<text class="text-27">返利余额</text>
							</view>
							<view class="flex-col block_23">
								<text class="text-26">{{info.integral}}</text>
								<text class="text-28">积分</text>
							</view>
						</view>
					</view>

					<view class="flex-col section_3">
						<view class="justify-between group_6">
							<text class="text_4">我的订单</text>
							<view class="flex-row group_7" @click="onClickImage_12(8)">
								<text class="text_5">查看全部订单</text>
								<image
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558021231875960732.png"
									class="image_2" />
							</view>
						</view>
						<view class="flex-row equal-division">
							<view class="flex-col items-center equal-division-item" @click="onClickImage_12(4)">

								<image
									src="../../static/dafukuan.png"
									class="image_3" />
				       		  <text class="text_6">待付款</text>
								<view class="yuanquan" v-if="info.toPayCount != 0">{{info.toPayCount}}</view>
							</view>
							<view class="flex-col items-center equal-division-item" @click="onClickImage_12(0)">
								<image
									src="../../static/daifahuo.png"
									class="image_3" />
								<text class="text_6">待发货</text>
                <view class="yuanquan" v-if="info.unShipping != 0">{{info.unShipping}}</view>
							</view>
							<view class="flex-col items-center equal-division-item" @click="onClickImage_12(1)">
								<image
									src="../../static/dashouhuo.png"
									class="image_3" />
								<text class="text_6">待收货</text>
                <view class="yuanquan" v-if="info.unGetting != 0">{{info.unGetting}}</view>
							</view>

							<view class="flex-col items-center equal-division-item" @click="onClickImage_12(2)">
								<image
									src="../../static/dapingjia.png"
									class="image_3" />
								<text class="text_6">待评价</text>
                <view class="yuanquan" v-if="info.getting != 0">{{info.getting}}</view>
							</view>
							<view class="flex-col items-center equal-division-item" @click="onClickImage_12(3)">
								<image
									src="../../static/shouhou.png"
									class="image_3" />
								<text class="text_6">售后</text>
                <view class="yuanquan" v-if="info.finish != 0">{{info.finish}}</view>
							</view>
						</view>
						<view class=""></view>
					</view>
					<view class="flex-col section_4">
						<text class="text_12">常用功能</text>
						<view class="flex-row equal-division_1">
							<view class="flex-col items-center equal-division-item_1" @click="ExpertsLn()">
								<image
									src="../../static/shoucang.png"
									class="image_3" />
								<text class="text_13">我的收藏</text>
							</view>
          <!--<view class="flex-col items-center equal-division-item_1" @click="distribution()">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827857765829.png"
									class="image_3" />
								<text class="text_13">推广分销</text>
							</view>-->

              <button class="flex-col equal-division-item_1 " open-type="contact"
                      style="align-items: center;margin-left: 40rpx; margin-right: 0rpx">
                <image
                    src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827851285410.png"
                    class="image_3" />
                <text class="text_13">联系客服</text>
              </button>

              <view class="flex-col items-center equal-division-item_1" @click="discountCoupon()">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028846355448958.png"
									class="image_3" />
								<text class="text_13">会员中心</text>
							</view>
							<view class="flex-col items-center equal-division-item_1 group_13" @click="wallet()">
								<image
									src="../../static/dizhixinxi.png"
									class="image_3" />
								<text class="text_13">地址信息</text>
							</view>



						</view>
						<view class="flex-row equal-division_1">
                            <!-- <view class="flex-col items-center equal-division-item_1 statistics " @click="statistics">
                             								<image
                             									src="../../static/tongji.png"
                             									class="image_3" />
                             								<text class="text_13">统计管理</text>
                             							</view> -->



						</view>

					</view>

				</view>
			</view>
		</view>
	</view>
</template>

<script>
import {
  getPersonalAdvertisingSpace,
  getselect,
  getconfirm, shopPersonCenter, dailyCheck
} from '../../api/index.js'
	export default {

		name: 'user',
		props: {
			cur: String,
		},
		components: {},
		data() {
			return {
				value1: 1,
				disabled: true,
				PersonalAdvertisingSpace: '',
				nikeName:'A-ZU',
				vipName:'V1',
				avatar:'',
				show: true,
				vip: '',
				yesnovip: '',
				balance:1688.68,
				rebateBalance:1000,
				integral:168,
				value:6,
				info: {}

			};
		},

		created() {
      this.shopPersonCenter()
			// if (this.$store.state.userInfo.wxInfo.ifexperts) {
			//   this.avatar='http://152.136.15.132:9000/'+this.$store.state.userInfo.wxInfo.avatar
			// } else {
			//   this.avatar=this.$store.state.userInfo.wxInfo.avatar
			// }
			//  this.nikeName=this.$store.state.userInfo.wxInfo.nikeName
		},
		methods: {
      shopPersonCenter() {
        shopPersonCenter().then(res => {
          this.info = Object.assign({}, this.$store.state.userInfo.wxInfo, res.data)
          console.log('info', this.info)
        })
      },
		      discountCoupon(){
				  uni.navigateTo({
				  	url:'../../subPackages/pages/shoppingmall/memberCenter/memberCenter'
				  })
			  },
			  recharge(){
				 uni.navigateTo({
				 	url:'../../subPackages/pages/shoppingmall/recharge/recharge?balance=' + this.info.balance
				 })
			  },
			qiandao(){
        dailyCheck().then(res => {
          uni.showToast({
            title:'签到成功',
            icon:'success',
            duration:1000
          })
        }).catch(err => {
          uni.showToast({
            title: '今日已签到',
            duration:1000
          })
        })
			},
			// quanBu(){
			// 	//全部订单
			// 	uni.navigateTo({
			// 		url:'myorder/myorder'
			// 	})
			// },
			qiehuan() {
				if (this.info.userType == "2") {
					let that = this
					uni.showModal({
						content: '确定要更换身份吗？',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								that.$emit('resurl', that.value1);
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				} else {
					uni.showModal({
						content: '抱歉您还没有其他身份',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								// that.$emit('resurl',that.value1);
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}


			},

			onClickImage_12(a) {
				uni.navigateTo({
					url: '../../subPackages/pages/shoppingmall/myorder/myorder?id=' + String(a),
				});
			},


			distribution() {
				//分销
				uni.navigateTo({
					url: '/pages/distribution/distribution'
				})
			},

            wallet(){
                uni.navigateTo({
					//地址信息
                    url:'../../subPackages/pages/shoppingmall/address?type=1'
                })

            },
            help(){
                uni.navigateTo({
                    url:'/pages/User/help'
                })
            },
            we(){
                uni.navigateTo({
                    url:'/pages/User/we'
                })
            },
            opinion(){
               uni.navigateTo({
                   url:'/pages/User/opinion'
               })
            },
            phone(){
                uni.navigateTo({
                    url:'/pages/User/phone'
                })
            },
			ExpertsLn() {
				//我的收藏
                uni.navigateTo({
                	url: '../../subPackages/pages/shoppingmall/conllection'
                });

			},

		},
	};
</script>

<style scoped lang="css">
	button::after {
		border: none;
	}

	button {
		background-color: #fff;
	}

	.image_21 {
		width: 1.69rem;
		height: 1.69rem;
	}

	.equal-division-item {
		flex: 1 1 4.31rem;
		padding: 0.33rem 0;
	}

	.equal-division-item_1 {
		margin-left: 0.2rem;
		padding: 0.36rem 0 0.31rem;
	}

	.equal-division-item_2 {
		margin-left: 0.16rem;
		flex: 1 1 5.28rem;
		padding: 0.3rem 0 0.31rem;
	}

	.image_3 {
		width: 80rpx;
		height:80rpx;
	}

	.text_6 {
		margin-top: 0.58rem;
		color: #333333;
		font-size: 0.75rem;
		font-family: SourceHanSansCN;
		line-height: 0.72rem;
	}

	.text_13 {
		margin-top: 0.52rem;
		color: #333333;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.text_22 {
		margin-top: 0.3rem;
		color: #2f356f;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.page {
		background-color: #ffffff;
		width: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		height: 100%;
	}

	.group {}

	.tab-bar {
		padding: 0.19rem 1.97rem 0.44rem 2.03rem;
		background-color: #ffffff;
	}

	.section_1 {
		margin-top: -3.09rem;
		padding: 5.13rem 0.41rem 10rpx 0.91rem;
		background-image: linear-gradient(#2490E5, #F4F5F9, #F4F5F9);
		background-size: 100% 100%;
		background-repeat: no-repeat;
		position: relative;
	}

	.group_23 {
		height: 2.47rem;
	}

	.group_24 {
		height: 2.41rem;
	}

	.group_25 {
		height: 2.44rem;
	}

	.group_26 {
		height: 2.42rem;
	}

	.group_27 {
		margin-top: 0.094rem;
		height: 2.38rem;
	}

	.text {
		align-self: center;
		color: #000;
		font-size: 1.06rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 1rem;
	}

	.group_1 {
		margin-top: 2.13rem;
		align-items: center;
		margin-bottom: 2.13rem;
	}

	.signIn {
		width: 27rpx;
		height: 27rpx;
	}

	.text_29 {
		margin-top: 0.19rem;
		color: #9dabc0;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.text_30 {
		margin-top: 0.13rem;
		color: #9dabc0;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.text_31 {
		margin-top: 0.16rem;
		color: #9dabc0;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.text_32 {
		margin-top: 0.14rem;
		color: #9dabc0;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.text_33 {
		margin-top: 0.094rem;
		color: #6d79fe;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.section_2 {
		padding: 0.19rem 0 0.75rem;
		background-size: 100% 100%;
		background-repeat: no-repeat;
		width: 5.47rem;
		height: 2.69rem;
	}

	.section_3 {
    height: 16vh;
		margin-right: 0.53rem;
		padding: 1rem 0 0.78rem;
		background-color: #ffffff;
		border-radius: 0.47rem;
		margin-top: 30rpx;
	}

	.section_4 {
		margin-right: 0.47rem;
		margin-top: 1rem;
		padding: 0.91rem 0 1.16rem;
		background-color: #ffffff;
		border-radius: 0.47rem;
	}

	.section_5 {
		margin-right: 0.53rem;
		margin-top: 0.94rem;
		padding: 0.94rem 0 0.72rem;
		background-color: #ffffff;
		border-radius: 0.47rem;
	}

	.section_6 {
		margin-right: 0.56rem;
		margin-top: 0.97rem;
		padding: 0.66rem 0 0.59rem;
		background-color: #fff0e3;
		border-radius: 0.47rem;
	}

	.image {
		width: 4.19rem;
		height: 4.19rem;
		border-radius: 200rpx;
	}

	.group_3 {
		margin-left: 0.69rem;
		align-self: center;
	}

	.text-wrapper {
		width: 150rpx;
		height: 60rpx;
		background-color: #2490E5;
		color: #FFFFFF;
		border-radius: 26rpx 0 0 26rpx;
		margin-left: 40rpx;
		line-height: 60rpx;
	}
.text_3 {
		margin-left: 20rpx;
	}

	.group_6 {
		padding: 0 0.94rem;
	}

	.equal-division {
		margin-top: 0.91rem;
	}

	.text_12 {
		margin-left: 0.97rem;
		align-self: flex-start;
		color: #333333;
		font-size: 1rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 0.94rem;
	}

	.equal-division_1 {
		margin-top: 0.91rem;
		padding: 0 0.31rem;
		justify-content: space-around;
	}

	.group_17 {
		margin-top: 0.94rem;
		padding: 0 2.22rem;
	}

	.group_18 {
		margin-top: 0.59rem;
		padding: 0 1.59rem;
	}

	.text_21 {
		margin-left: 0.91rem;
		align-self: flex-start;
		color: #333333;
		font-size: 1rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 0.97rem;
	}

	.equal-division_2 {
		margin-top: 0.91rem;
		padding: 0 0.23rem;
	}

	.image_20 {
		align-self: center;
		width: 0.69rem;
		height: 0.69rem;
	}

	.text_27 {
		margin-left: 0.94rem;
		align-self: center;
		color: #c4a78a;
		font-size: 0.75rem;
		font-family: SourceHanSansCN;
		line-height: 0.75rem;
	}

	.text-wrapper_1 {
		margin-left: 0.91rem;
		padding: 0.41rem 0 0.38rem;
		border-radius: 0.78rem;
		width: 3.63rem;
		height: 1.56rem;
		border: solid 0.063rem #fea14a;
	}

	.text_2 {
		margin-top: 0.91rem;
		color: #666666;
		font-size: 0.75rem;
		font-family: SourceHanSansCN;
		line-height: 0.72rem;
	}


	.text_4 {
		color: #333333;
		font-size: 0.94rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 0.91rem;
	}

	.group_7 {
		margin-bottom: 0.16rem;
	}

	.group_13 {
		margin-left: 0;
	}

	.image_13 {
		margin-top: 0.094rem;
		width: 1.41rem;
		height: 1.31rem;
	}

	.image_14 {
		margin-left: 3.81rem;
		width: 1.41rem;
		height: 1.44rem;
	}

	.image_15 {
		margin-left: 3.97rem;
		width: 1.41rem;
		height: 1.41rem;
	}

	.text_18 {
		color: #333333;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.text_19 {
		margin-left: 2.44rem;
		color: #333333;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.69rem;
	}

	.text_20 {
		margin-left: 2.53rem;
		color: #333333;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.group_19 {
		margin-left: 0;
	}

	.text_28 {
		color: #fea14a;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.text_1 {
		color: #333333;
		font-size: 1.06rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 1.3rem;
		display: inline-block;
		width: 40vw;
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;

	}

	.image_1 {
		margin-right: 3.06rem;
		width: 0.88rem;
		height: 0.88rem;
	}

	.text_5 {
		color: #666666;
		font-size: 0.75rem;
		font-family: SourceHanSansCN;
		line-height: 0.75rem;
	}

	.image_2 {
		margin: 0.13rem 0 0.094rem 0.28rem;
		flex-shrink: 0;
		width: 0.28rem;
		height: 0.53rem;
	}
	.section_6{
		margin-right: 0.53rem;
		/* padding: 1rem 0 0.78rem; */
		background-color: #ffffff;
		border-radius: 0.47rem;
		height: 240rpx;
	}
	.block_1{
		width: 100%;
		height: 60rpx;
		background-color: #FFE6BE;
		border-radius: 0.47rem 0.47rem 0 0;
		margin-top: -22rpx;
	}
	.block_11{
		width: 31%;
		height: 60rpx;

		line-height: 60rpx;
	}
	.block_12{
		width: 30%;
		height: 60rpx;

		line-height: 60rpx;
		margin-left: 240rpx;
	}
	.image-1{
		width: 40rpx;
		height: 40rpx;
		margin: 10rpx 0 0 30rpx;
	}
	.image-2{
		margin: 20rpx 0 0 10rpx;

	}
	.text-23{
		font-size: 30rpx;
		color: #333333;
		margin-left: 15rpx;
		font-family: SourceHanSansCN-Regular;
		font-weight: Regular;
	}
	.text-24{
		font-size: 24rpx;
		color: #333333;
		margin-left: 15rpx;
		font-family: SourceHanSansCN-Regular;
		font-weight: Regular;
	}
	.block_2{
		width: 100%;
		height: 180rpx;

	}
	.block_21{
		width: 25%;
		height: 180rpx;

		margin-left: 10%;
	}
	.block_22{
		width: 20%;
		height: 180rpx;

		margin-left: 15%;
	}
	.block_23{
		width: 15%;
		height: 180rpx;

		margin-left: 15%;
	}
	.block_211{
		width: 100%;
		height: 60rpx;
		line-height: 60rpx;
		font-size: 40rpx;
	font-family: SourceHanSansCN-Medium;
	font-weight: Medium;
		margin: 20rpx 0 0 0;
	}
	.block_212{
		width: 100%;
		height: 60rpx;
		line-height: 60rpx;

		margin: 0 0 0 0;
	}
	.text-25{
		font-size: 26rpx;
	}
	.button{
		width: 100rpx;
		height: 40rpx;
		margin: 10rpx 0 0 15rpx;
	}
	.text-26{
		font-size: 40rpx;

		margin-left: 15rpx;
		font-family: SourceHanSansCN-Medium;
		font-weight: Medium;
		margin: 20rpx 0 0 0;
	}
	.text-27{
		font-size: 26rpx;
		color: #333333;
		margin-left: 15rpx;
		font-family: SourceHanSansCN-Regular;
		font-weight:Regular;
		margin: 18rpx 0 0 0;
	}
	.text-28{
		font-size: 26rpx;
		color: #333333;
		margin-left: 15rpx;
		font-family: SourceHanSansCN-Regular;
		font-weight:Regular;
		margin: 18rpx 0 0 15rpx;
	}
	.statistics{
		margin-left: 40rpx;
	}
	.yuanquan{
		width: 30rpx;
		height: 30rpx;
		line-height: 30rpx;
		border-radius: 50%;
		background-color: #FF5151;
		color: #FFFFFF;
		text-align: center;
		margin: -110rpx 0 0 40rpx;
	}
	.u-icon{
		margin-left: 20rpx;
	}
</style>
